class Solution
{
public:
    vector<long long> countOfPairs(int n, int x, int y)
    {
        if (x > y)
        {
            swap(x, y);
        }
        if (x == y || x == y - 1)
        {
            vector<long long> result(n, 0);
            for (int i = 0; i < n; i++)
            {
                result[i] = 2 * (n - i - 1);
            }
            return result;
        }

        auto dist = [](int i, int j)
        {
            return abs(i - j);
        };

        int sep1 = (x + y + 1) / 2;
        int sep2 = (x + y - 1) / 2;
        int d = (y - x) / 2;

        vector<long long> diff(n + 1, 0);
        for (int i = 1; i < x; ++i)
        {
            diff[dist(i, i + 1) - 1] += 1;
            diff[dist(i, sep1)] -= 1;

            diff[dist(i, x) + 1 + dist(y, y) - 1] += 1;
            diff[dist(i, x) + 1 + dist(y, sep1 + 1)] -= 1;

            if (y < n)
            {
                diff[dist(i, x) + 1 + dist(y, y + 1) - 1] += 1;
                diff[dist(i, x) + 1 + dist(y, n)] -= 1;
            }
        }

        for (int i = x; i <= sep2; ++i)
        {
            diff[dist(i, i + 1) - 1] += 1;
            diff[dist(i, i + d)] -= 1;

            diff[dist(i, x) + 1 + dist(y, y) - 1] += 1;
            diff[dist(i, x) + 1 + dist(y, i + d + 1)] -= 1;

            if (y < n)
            {
                diff[dist(i, x) + 1 + dist(y, y + 1) - 1] += 1;
                diff[dist(i, x) + 1 + dist(y, n)] -= 1;
            }
        }

        for (int i = sep2 + 1; i <= n; ++i)
        {
            diff[dist(i, i + 1) - 1] += 1;
            diff[dist(i, n)] -= 1;
        }

        vector<long long> result(n, 0);
        long long sum = 0;
        for (int i = 0; i < n; ++i)
        {
            sum += diff[i];
            result[i] = sum * 2;
        }
        return result;
    }
};